<?php
/**
 * Author: LCY<409028735@qq.com>
 * Time: 2021/11/19 14:42
 * Note:
 */
namespace app\admin\model;
use think\Model;

class Admin extends Model
{
    protected $auto = ['avatar'];

    /**
     * 生成默认头像
     * @param $val
     * @return mixed|string
     * Author: LCY<409028735@qq.com>
     * Time: 2021/12/25 21:31
     * Note:
     */
    public function setAvatarAttr($val)
    {
        return !empty($val) ? $val : get_default_img('admin-avatar');
    }

    /**
     * 设置加密密码
     * @param $val
     * @return string
     * Author: LCY<409028735@qq.com>
     * Time: 2021/12/25 21:04
     * Note:
     */
    public function setPasswordAttr($val)
    {
        return encrypt_password($val);
    }

}